package com.university.mentalhealthplatform.teacherV2.service;

import com.university.mentalhealthplatform.appModels.Warning;
import com.university.mentalhealthplatform.teacherV2.repository.WarningRepositoryV2;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class WarningServiceV2 {
    @Autowired
    private WarningRepositoryV2 warningRepository;

    public List<Warning> getAllWarnings() {
        return warningRepository.findAll();
    }

    public Warning getWarningById(Long id) {
        return warningRepository.findById(id).orElse(null);
    }

    public Warning saveWarning(Warning warning) {
        return warningRepository.save(warning);
    }

    public void deleteWarning(Long id) {
        warningRepository.deleteById(id);
    }
}
